
<script>
	$(function(){
	$( "#dialog:ui-dialog" ).dialog( "destroy" );
	     var comment = $( "#comment" ),
          allFields = $( [] ).add( comment ),//这行代码很重要
			tips = $( ".validateTips" );

		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}
		$( "#edit_comment" ).dialog({
			autoOpen: false,
			height: 350,
			width: 550,
			modal: true,
			buttons: {
				"确认修改": function() {
					var bValid = true;
					allFields.removeClass( "ui-state-error" );
					if ( bValid ) {
						var comment=$("#comment").val();
						var id=$("#groupCommentId").val();
						  $.ajax({
                              url:"updateGroupComment.php",
                              type:"POST",
                              data:"id="+id+"&comment="+comment,
                              success:function(data){
                                  if(data)
                                       {
                                       $( this ).dialog( "close" );
                                       location.href='index.php';
                                       }
                                  else{
                                       $( ".validateTips" ).text("修改组备注失败!");
                                       }
                                  }
                                  });      
					}
				},
				"取            消": function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
		
$("#editcomment").click(function(){
	$("#comment").val($("#editcomment").attr("rel"));
	$( "#edit_comment" ).dialog( "open" );
	return false;
	
});
		})
</script>
<?php
?>
<div id="edit_comment" title="修改组备注">
	<fieldset>
		<input type="hidden" id="groupCommentId"
			value="<?php if(isset($_SESSION["groupId"])) echo $_SESSION["groupId"];?>" />
		<label>备注:</label>
		<textarea id="comment" cols="43" rows='4' autofocus="autofocus"></textarea>
	</fieldset>
	<p class="validateTips">All form fields are required.</p>
</div>
<?php

?>